package pack0630.cn;
//成员内部类,表示一个类中定义的另一个类,理解为成员,相当于类中的属性和方法

//静态的属性和方法用类名调用(Outer.address)    属性中用static String address
public class Outer {
    String name="张无忌";
    String address="西安";

    public void sing(){
        Inner in=new Inner();
        System.out.println(in.age);

    }

    public class Inner{
        String name="郭靖";
        int age=20;

        public void eat(){
            System.out.println("eat,,,");
            //name相当于this.name,调用属性中的name,这里的name用就近原则
            System.out.println(name+"::"+address);
        }

    }

    public static void main(String[] args) {
        Outer ou=new Outer();
        Inner in=ou.new Inner();
        in.eat();
        ou.sing();
    }

}
